package com.codefox.service;

import java.util.List;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.codefox.entity.TbDrug;
import com.codefox.mapper.TbDrugMapper;

/**
 * 药品服务层
 * 
 * @author puma
 * @date 2018年10月8日 上午9:30:59
 */
@Service
public class TbDrugService {
	@Autowired
	SqlSessionFactory factory;
	
	/**
	 * 返回所有药品信息list集合
	 * @return list集合
	 */
	public List<TbDrug> listDrug(){
		try(SqlSession sqlSession = factory.openSession()){
			return sqlSession.getMapper(TbDrugMapper.class).listDrug();
		}
	}
}
